﻿using System;
using System.Web.UI.WebControls;
using Ue.Framework.Web.WebControls;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.Web.UI;
using Ue.Qcdz.Domain;
using Ue.Qcdz.Domain.SaleInfos;

namespace Ue.Qcdz.UI.Controls.SaleInfo
{
    public class SaleInfoSearchList : SkinnedGridView
    {
        #region Overrides of SkinnedControl

        private string skinFileName = "~/Themes/zh-cn/Skins/SaleInfo/SaleInfoSearchList.ascx";
        private SaleInfoTypeDropDown saleInfoTypeDropDown1;
        private TextBox tbxSearchKey;
        public string SearchKey { get; set; }
        public string SalesType { get; set; }
        public SaleInfoSearchList()
        {
            SearchKey = SiteContext.GetSiteContext().SearchKey;
            SalesType = SiteContext.GetSiteContext().SalesType;
        }

        protected override string GetSkinFileName()
        {
            return skinFileName;
        }
        protected override void InitializeSkin(System.Web.UI.Control skin)
        {
            
            saleInfoTypeDropDown1 = skin.FindControl<SaleInfoTypeDropDown>("saleInfoTypeDropDown1");
            tbxSearchKey = skin.FindControl<TextBox>("tbxSearchKey");
            base.InitializeSkin(skin);
        }
        #endregion

        #region Overrides of SkinnedGridView

        protected override void GridViewDataBind(object sender, EventArgs args)
        {
            IDataResult<Ue.Qcdz.Domain.SaleInfos.SaleInfo> dataResult = SaleInfoService.GetSaleInfo(this);
            Repeater repeater = sender as Repeater;
            repeater.DataSource = dataResult.DataObjects;
            repeater.DataBind();
            this.RecordCount = dataResult.RecordCount;
        }

        #endregion
    }
}
